var t = getApp();

Page({
    data: {
        searchValue: "",
        listData: "",
        current_page: 1,
        last_page: 1,
        consult_type: 0
    },
    onLoad: function() {
        this.getData();
    },
    getData: function() {
        var a = this, e = t.getNetAddresss("plugin.lawyer-platform.frontend.controllers.goods.getList");
        t._postNetWork({
            url: e,
            data: {
                goods_type: 0
            },
            success: function(t) {
                1 == t.data.result && a.setData({
                    listData: t.data.data.list.data,
                    current_page: t.data.data.list.current_page,
                    last_page: t.data.data.list.last_page
                });
            }
        });
    },
    getMoreData: function() {
        var a = this, e = t.getNetAddresss("plugin.lawyer-platform.frontend.controllers.goods.getList"), s = {};
        s.page = this.data.page + 1, this.data.keyword && (s.kwd = this.data.keyword), s.goods_type = 0, 
        t._postNetWork({
            url: e,
            data: s,
            success: function(t) {
                1 == t.data.result && (a.data.listData = a.data.listData.concat(t.data.data.list.data), 
                a.setData({
                    listData: a.data.listData,
                    current_page: t.data.data.list.current_page,
                    last_page: t.data.data.list.last_page
                }));
            }
        });
    },
    goodsDetail: function(t) {
        var a = t.currentTarget.dataset.info.id;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + a
        });
    },
    onChange: function(t) {
        this.setData({
            searchValue: t.detail
        }), this.search(t.detail);
    },
    search: function(a) {
        var e = this, s = t.getNetAddresss("plugin.lawyer-platform.frontend.controllers.goods.getList"), o = {
            kwd: a,
            goods_type: 0
        };
        t._postNetWork({
            url: s,
            data: o,
            success: function(t) {
                1 == t.data.result && e.setData({
                    listData: t.data.data.list.data,
                    current_page: t.data.data.list.current_page,
                    last_page: t.data.data.list.last_page
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.current_page < this.data.last_page && this.getMoreData();
    },
    onShareAppMessage: function() {}
});